package com.hotau.product;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RatingBar;
import android.widget.TextView;

import com.hotau.R;
import com.hotau.product.vo.Comment;

public class CommentDetailFragment extends Fragment {
	private Comment comment;

	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return inflater.inflate(R.layout.location_comment_detail, container,
				false);
	}

	@Override
	public void onActivityCreated(Bundle bundle) {
		super.onActivityCreated(bundle);

		if (bundle != null) {
			comment = (Comment) bundle.getSerializable("comment");
		}
		setHasOptionsMenu(true);

		((TextView) (this.getActivity()
				.findViewById(R.id.location_comment_item_username)))
				.setText(comment.commentUserId);

		((TextView) (this.getActivity()
				.findViewById(R.id.location_comment_item_time)))
				.setText(comment.commentDate);

		((TextView) (this.getActivity()
				.findViewById(R.id.location_comment_detail_description)))
				.setText(comment.commentContext);

		((RatingBar) (this.getActivity()
				.findViewById(R.id.location_comment_detail_rate)))
				.setRating(comment.getComment1Count());
	}
}
